@extends('layouts.admin')
@push('morecss')
    <!-- Bootstrap Treeview -->
    <link rel="stylesheet" type="text/css" href="{{ asset('/vendor/bootstrap-treeview/dist/bootstrap-treeview.min.css') }}" />
    <!-- fontIconPicker core CSS -->
    <link rel="stylesheet" type="text/css" href="{{ asset('/vendor/fontIconPicker/css/jquery.fonticonpicker.min.css') }}" />
    <link rel="stylesheet" type="text/css" href="{{ asset('/vendor/fontIconPicker/themes/bootstrap-theme/jquery.fonticonpicker.bootstrap.min.css') }}" />
@endpush
@push('morescript')
    <!-- Bootstrap Treeview -->
    <script src="{{ asset('/vendor/bootstrap-treeview/dist/bootstrap-treeview.min.js') }}"></script>
    <!-- fontIconPicker JS -->
    <script type="text/javascript" src="{{ asset('/vendor/fontIconPicker/jquery.fonticonpicker.min.js') }}"></script>
    <script type="application/javascript">
        let page_params = {
            @can('admin.sysmenu.index')
            url_list: '{{ route('admin.sysmenu.index') }}',
            @endcan
            @can('admin.sysmenu.create')
            url_add: '{{ route('admin.sysmenu.create') }}',
            @endcan
            @can('admin.sysmenu.update')
            url_edit: '{{ route('admin.sysmenu.update') }}',
            @endcan
            @can('admin.sysmenu.destroy')
            url_del: '{{ route('admin.sysmenu.destroy') }}',
            @endcan
        };
    </script>
    <!-- require page js -->
    <script src="{{ mix('js/admin/sysmenu_index.js') }}"></script>
@endpush
@section('content')
    <!-- 主体内容 -->
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="ibox-content m-b-sm border-bottom">
            <div class="row">
                <div class="col-sm-2">
                    <div class="form-group">
                        <label class="control-label" for="product_name">&nbsp;&nbsp;</label>
                        <div>
                            @can('admin.sysmenu.create')
                            <button class="btn btn-primary" type="button" id="btn-add"><i class="fa fa-plus"></i>
                                添加顶级菜单
                            </button>
                            @endcan
                        </div>
                    </div>
                </div>
                <div class="col-sm-4 col-sm-offset-4">
                    <div class="form-group">
                        <label class="control-label" for="product_name">菜单分组</label>
                        <select class="form-control" name="group_id" id="group_id">
                            @foreach ($groupList as $groupK => $groupV)
                            <option value="{{ $groupV['group_id'] }}">{{ $groupV['group_name'] }}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                <div class="col-sm-2">
                    <div class="form-group">
                        <label class="control-label" for="product_name">&nbsp;&nbsp;</label>
                        <div>
                            <button class="btn btn-primary" type="button" id="btn-search"><i class="fa fa-search"></i>
                                搜索
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>菜单列表</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="treeview" id="tree"></div>
                    </div>

                </div>
            </div>
        </div>
    </div>

<!-- 节点操作询问层 -->
<div class="ibox-content" id="box_ask" style="display: none">
    <div class="form-horizontal m-t">
        <div class="form-group" style="text-align: center">
            @can('admin.sysmenu.create')
            <button class="btn btn-success" type="button" id="btn-add-child">
                <i class="fa fa-plus"></i>
                添加子菜单
            </button>
            @endcan
            @can('admin.sysmenu.update')
            <button class="btn btn-primary" type="button" id="btn-edit">
                <i class="fa fa-edit"></i>
                编辑菜单
            </button>
            @endcan
            @can('admin.sysmenu.destroy')
            <button class="btn btn-danger" type="button" id="btn-del">
                <i class="fa fa-trash-o"></i>
                删除菜单
            </button>
            @endcan
        </div>
    </div>
</div>
<!-- 节点操作询问层 -->

<!-- 菜单编辑层 -->
<div class="ibox-content" id="box-form" style="display: none">
    <form id="form" method="POST" class="form-horizontal">
        <input type="hidden" name="menu_id" id="menu_id" value="0">
        <input type="hidden" name="parent_id" id="parent_id" value="0">
        <input type="hidden" name="group_id" id="group_id" value="">
        <div class="form-group">
            <label class="col-sm-2 control-label">菜单名</label>
            <div class="col-sm-10">
                <input type="text" name="menu_name" id="menu_name" value="" class="form-control">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">绑定权限</label>
            <div class="col-sm-10">
                <select class="form-control" name="perm_id">
                    {!! $permOptionHtml !!}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">路由参数</label>
            <div class="col-sm-10">
                <input type="text" name="route_params" id="route_params" value="" class="form-control">
                <span class="help-block m-b-none">url参数字符串,例如：first=value&arr[]=foo+bar&arr[]=baz</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">菜单图标</label>
            <div class="col-sm-10">
                <!-- INPUT element -->
                <input class="form-control" type="text" name="icon_class" id="icon_class" value="" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">描述</label>
            <div class="col-sm-10">
                <textarea class="form-control" placeholder="输入描述" name="description" id="description"></textarea>
                <span class="help-block m-b-none">菜单说明</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">排序</label>
            <div class="col-sm-4">
                <input type="number" min="1" step="1" name="order_num" id="order_num" value="999" class="form-control">
                <span class="help-block m-b-none">数字越小越靠前</span>
            </div>
        </div>
        <div class="hr-line-dashed"></div>
        <div class="form-group">
            <div class="col-sm-4 col-sm-offset-4">
                <button class="btn btn-primary" type="button" id="btn-sub">
                    保存
                </button>
            </div>
        </div>
    </form>
</div>
<!-- 菜单编辑层 -->
@endsection